package day19;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Stream03 {
    public static void main(String[] args) {
        ArrayList<String> manList=new ArrayList<>();
        ArrayList<String> womanList=new ArrayList<>();
        Collections.addAll(manList,"蔡坤坤，24","叶后弦，23","刘不甜，22","吴倩，24","骨架，30","小亮亮，27");
        Collections.addAll(womanList,"赵小颖，35","杨颖，36","高元元，43","张天天，31","刘诗，35","杨小幂，33");
        Stream<String> stream1 = manList.stream()
                .filter(s -> (s.split("，")[0].length() == 3))
                .limit(2);
        Stream<String> stream2 = womanList.stream()
                .filter(s -> s.split("，")[0].charAt(0)=='杨')
                .skip(1);
        List<Actor> collect = Stream.concat(stream1, stream2)
                .map(s -> {
                    String name = s.split("，")[0];
                    int age = Integer.parseInt(s.split("，")[1]);
                    return new Actor(name, age);
                })
                .collect(Collectors.toList());
        System.out.println(collect);
    }
}
